//
//  mm_outCheckDisUserDefinedCell.m
//  HondaPro_2
//
//  Created by Eric on 13-7-18.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "mm_outCheckDisUserDefinedCell.h"

@implementation mm_outCheckDisUserDefinedCell
@synthesize arrForAllKeys = _arrForAllKeys;
@synthesize dicAllLblskOnCell = _dicAllLblskOnCell;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initLblsOnCell];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

//自定义cell
-(void)initLblsOnCell
{
    self.arrForAllKeys = [NSArray arrayWithObjects:
                          MM_OUT_CHECK_OUT_CHECK_NUMBER_KEY_STR_,
                          MM_OUT_CHECK_CHECK_ITEM_KEY_STR_,
                          MM_OUT_CHECK_DEFECT_COUNT_KEY_STR_,
                          MM_OUT_CHECK_DEFECT_DESCRIPTION_KEY_STR_, nil];
    
    self.dicAllLblskOnCell = [NSMutableDictionary dictionaryWithCapacity:[_arrForAllKeys count]];
    
    NSDictionary *dicAllLblsRect = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSValue valueWithCGRect:CGRectMake(0, 0, 80, 50)],MM_OUT_CHECK_OUT_CHECK_NUMBER_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(81, 0, 80, 50)],MM_OUT_CHECK_CHECK_ITEM_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(162, 0, 80, 50)],MM_OUT_CHECK_DEFECT_COUNT_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(243, 0, 207, 50)],MM_OUT_CHECK_DEFECT_DESCRIPTION_KEY_STR_, nil];
    
    for (int i = 0; i<[_arrForAllKeys count]; i++)
    {
        NSString *strKey = [_arrForAllKeys objectAtIndex:i];
        CGRect rect = (CGRect)[[dicAllLblsRect objectForKey:strKey] CGRectValue];
        UILabel *lbl = [[UILabel alloc] initWithFrame:rect];
        lbl.textColor = [UIColor grayColor];
        lbl.font = [UIFont systemFontOfSize:16];
        lbl.backgroundColor = [UIColor clearColor];
        [self.dicAllLblskOnCell setObject:lbl forKey:strKey];
        [self addSubview:lbl];
    }
}

@end
